home *** CD-ROM | disk | FTP | other *** search
Text File | 1992-07-01 | 29.5 KB | 622 lines | [TEXT/pdos] |
-
-
-
-
- GSBug is Your Friend
- (a quick intro to GSBug)
- v1.3 1-Jul-92
- by Tim Swihart and Dave Lyons
-
-
-
- So, you just got GSBug installed for the first time and don't have a clue how
- to use it. Sure, you could call Resource Central (1-913-469-6502) and order
- the complete package, but you're not sure if GSBug will really help you find
- those nasty bugs in the Apple IIGS software you're developing. Well, from the
- next paragraph until the end of this file, we'll present a quick introduction
- to some of the reasons why GSBug is a "MUST HAVE" tool for all IIGS developers.
- It doesn't matter what language you program in, or which environment you use,
- GSBug is the key to tracking down and exterminating those nasty bugs that make
- your software look shabby.
-
-
- Installation
-
- Before we can really get into it, you need to install GSBug and the
- GSBug.Templates file and reboot your IIGS. If you only have one computer,
- then print this file and continue reading from the printout. GSBug is an INIT
- with the file name "Debug.Init" - install it by copying this file into your
- boot disk's System/System.Setup folder. Copy the "GSBug.Templates" file into
- the same folder.
-
- Over the course of time, the name used for the GSBug init file has changed
- slightly. To be certain you don't accidentally install two (or more) copies
- of GSBug, carefully examine the contents of the System/System.Setup folder on
- your boot disk. If you see more than one file with a name similar to
- "Debug.Init" (such as "gsbug.init" or "GSBug1.5B11init") then take out all but
- the most recent one. Having more than one copy of GSBug causes problems (such
- as crashes during booting).
-
-
- Care & Feeding of GSBug
-
- Now that everything is installed, reboot your computer. No need to launch any
- particular application just yet, we have to explain the various parts of
- GSBug's screen and we want to cover a few basic GSBug commands before we go bug
- hunting. We'll assume you're running the Finder right now, but it really
- doesn't matter a whole lot what application is running, as long as it is a
- 16-bit application (that is, a true IIGS application).
-
- You can pop into GSBug at any time (assuming interrupts aren't disabled) by
- pressing OPEN APPLE-OPTION-CONTROL-ESC (if you're having troubles remembering
- all of those keys at once, just think of it as the same keys that you use to
- get to the built-in control panel plus the OPTION key). You'll be presented
- with a rather busy-looking 80-column text screen. (there's a screen dump
- right below this paragraph - we told you it was busy-looking screen)
-
-
- ------ beginning of screen dump ------
-
- Key BRKs DebugD K/PC B D S A X Y M Q L P nvmxdizc e i
- 00 d 9500 FD/688D FD 2500 1FE0 0000 4D95 0044 0C BE 1 03 00000011 0 0
-
- 1FF2:60 00/0000: BE '>' 00/0000-00-00
- 1FF1:43 00/0000: BE '>' 00/0000-00-00
- 1FF0:FE 00/0000: BE '>' 00/0000-00-00
- 1FEF:01 00/0000: BE '>' 00/0000-00-00
- 1FEE:37 00/0000: BE '>' 00/0000-00-00
- 1FED:0C 00/0000: BE '>' 00/0000-00-00
- 1FEC:00 00/0000: BE '>' 00/0000-00-00
- 1FEB:4D 00/0000: BE '>' 00/0000-00-00
- 1FEA:7A 00/0000: BE '>' 00/0000-00-00
- 1FE9:C0 00/0000: BE '>'
- 1FE8:00 00/0000: BE '>' E1/0000.000F-T
- 1FE7:2C 00/0000: BE '>' 01/FC00.FFFF-T
- 1FE6:00 00/0000: BE '>' 00/0000.0000-?
- 1FE5:E0 00/0000: BE '>' 00/0000.0000-?
- 1FE4:6A 00/0000: BE '>' 00/0000.0000-?
- 1FE3:B4 00/0000: BE '>' 00/0000.0000-?
- 1FE2:62 00/0000: BE '>' 00/0000.0000-?
- 1FE1:DA 00/0000: BE '>' 00/0000.0000-?
- 1FE0:FD 00/0000: BE '>' 00/0000.0000-?
-
- :GSBug v1.6 w/Glue & P8 Support (C) 1986-92 Apple Computer, Inc.
-
- ------ end of screen dump ------
-
-
- Top Two Lines
-
- The first two lines of the screen show the contents of various registers. The
- top line of the screen starts off with "Key BRKs DebugD" - those are headings
- for the items in the second line of the screen. The meanings of those
- headings (and the items under them) are:
-
- Heading Meaning
- ------- -------------------------------------------
- Key Modifiers used to separate debugger keys from application keys
-
- BRKs Below "BRKs" a combination of four characters show up, showing
- how GSBug will handle various kinds of breaks:
-
- "b" means breakpoints are in (use "in" or "b+" to put them
- in, "out" or "b-" to take them out)
-
- "t" means tool breaks are in (use TBrkIn or "t+" to put them
- in, TBrkOut or "t-" to take them out; setting a tool break
- with SetTBrk automatically puts tool breaks in)
-
- "o" means OS breaks are in (use OSBrkIn or "o+" to put them
- in, OSBrkOut or "o-" to take them out; setting an OS break
- with SetOSBrk automatically puts OS breaks in)
-
- In the 4th position, you normally see a "d" for Debugger breaks;
- if you want to get dumped into the monitor instead, use
- "mbrk" ("dbrk" gets you back to Debugger breaks)
-
- DebugD Debugger's direct page (1K in size) - in bank $00
- K/PC K=program bank, PC=program counter
-
- B app's data bank
- D current direct page in bank zero
-
- S current stack pointer
- A accumulator's value
-
- X X register's value
- Y Y register's value
-
- M machine state register's value
- Q quagmire register's value
-
- L Language card bank
- P processor-status register's value
-
- nvmxdizc bits that make up "P" (n=negative, c=carry, etc)
- e emulation mode flag
- d disassembly mode flag (0=recognize SEP & REP during "L"isting)
-
-
- If you want more information on a specific register's meaning then look it up
- in the IIGS Hardware reference manual, the GSBug manual, or any good book that
- covers the IIGS's internal hardware. Any of these register's values can be
- changed - we'll show how to do that in a few paragraphs or so.
-
-
- The Left-Hand Side
-
- The next major area of the screen is the 4-digit column of numbers running
- down the far left side. There is a colon on each line after the fourth
- digit, and then there is a column (two digits wide) of numbers. All of these
- numbers are in hex and this area is the stack. The four digit column, the
- colons, and the two digit column are collectively known as the "stack
- subdisplay area" - remember that, there's a test at the end of this file.
- The column on the left of the colon is the address of the stack and the
- column on the right (the two digit column) are the values on the stack.
- The bottom-most four digit stack address is the "top" of the stack (that is,
- if your app pushes anything on the stack, that's the address it would wind
- up at). As you step through your application (we'll show how in a minute,
- patience) the stack will scroll upwards as things are pushed onto it and
- downwards as things are pulled off of it.
-
-
- The Not-So-Left-Hand Side
-
- The next major area should be a column of "00/0000: BE '>'" known as the
- "RAM subdisplay area". This area is used to display any 19 memory locations
- that you want to keep an eye on. The value at each of those locations is
- shown in hex (that's what the "BE" means - location 00/0000 contains hex "BE"
- when we wrote this) and in ASCII (the ASCII version is between the single
- quote marks, the "'>'"). It is possible to have this subdisplay show a
- two-byte or a three-byte value instead of the one-byte value. You lose the
- ASCII display if you opt for the 2 or 3 byte values.
-
- After we finish explaining the rest of the screen, we'll come back and
- describe how to change these 19 "windows on memory" to look at what you want
- to monitor.
-
-
- The Center Part
-
- The next major area of the screen is the 9 lines of "00/0000-00-00", better
- known as the "Breakpoint subdisplay" (they're on the top half of the screen).
- GSBug lets you set up to 17 breakpoints in your program (not counting BRK
- instructions you imbed in your program yourself). Curious about how you set
- 17 break points when there are only 9 lines in this section? Did we mention
- that Resource Central stocks the manual? <grin> Seriously, you can "extend"
- the breakpoint subdisplay by shrinking the section under it (which we haven't
- described yet). For the purposes of this quick intro, We're not going to show
- how to do this (you need some kind of reason to get the manual). We'll just
- describe this area and later show how to set up to 9 break points.
-
- The "00/0000" part of the breakpoint subdisplay is obviously an address - in
- fact, it's the address you want to break on. The next part "-00-" is the
- trigger value. GSBug is smart enough to count how many times an address has
- been executed and break on a certain number (for example, put a "03" here and
- GSBug will break the third time that address is executed). The last part of
- this area is the running count - this is how GSBug lets you know how many times
- that area has been executed (rather than leave you wondering, it tells you and
- you can be ready for the break). You set the address and trigger portions and
- GSBug sets the count portion.
-
-
- The Bottom Part of the Center Part
-
- The bottom half of the center of the screen is known as the "Memory
- Protection Subdisplay" and starts off with "E1/0000.000F-T". This area can
- be expanded (or shrunk) by trading lines of this area for lines of the one
- above it (the "Breakpoint subdisplay"). If you want to know how to do this,
- read the manual from Resource Central, it's big (roughly 140 pages) and we're
- not retyping all of it here! <grin>
-
- The "E1/0000.000F" is the address range starting at E1/0000 and ending at
- E1/000F. The "T" at the end means that this range of memory is protected from
- code tracing. If you're tracing through your code and it jumps (JSR's, JSL's,
- whatever) into this range of memory, then the code in this range will NOT be
- traced - it will be executed at full speed instead.
-
- There are two other options for code protection ("W" and "H"). They are
- beyond the scope of this quick tutorial (we're only trying to cover the
- basics here).
-
-
- Where You Type Commands
-
- The bottom line on the screen is the command line subdisplay (catchy name,
- eh?). When you first enter GSBug, this line will contain the copyright
- message and version number for GSBug (unless you've used the DebugStr or
- SetMileStone "tool" calls to change this string). As soon as you press a
- key, the copyright message vanishes and your keypress shows up next to the
- blinking cursor. This is where you'll type various commands to make GSBug
- help you get the kinks out of your software.
-
-
- What's the Big Blank Spot For?
-
- The big blank area towards the far right of the screen is officially known as
- the "disassembly subdisplay" (it's one of the big reasons you're using GSBug -
- even if you don't know it yet). As you single-step through your software,
- trace through it, or just list areas of memory this area will show you the
- disassembled version of your program. One of the really slick things about
- this area is that it's smart enough to know about the names of GS/OS calls and
- Toolbox calls - so you see things like "_CheckUpdate" instead of "JSL E10000".
- That makes if VERY easy to line up pieces of your source with the disassembly
- if you're working in a high-level language. It also makes it a LOT easier to
- see what you're doing!
-
- GSBug also knows about the alternate Toolbox entry point (E10004) and will
- display those as tool calls also. The leading underscore ("_") lets you know
- that GSBug is substituting the tool's name for you. If the tool call is being
- made through "glue", then the underscore is preceded by an asterisk ("*").
-
- If you've ever used the built in "monitor" (we're not talking about your RGB
- monitor, we're talking about the disassembler that's been built into Apple IIs
- for a LONGGGGGGG time now), then you'll be able to quickly figure out that
- the left-most part of the disassembly subdisplay is the address, the inside
- columns are the hex bytes making up the code about to be disassembled, and the
- right-most part is the disassembled version of your software.
-
-
- Your First GSBug Command
-
- OK, you now know what all of the various areas of this rather busy-looking
- screen are for, so let's get down to business! The first thing to do is press
- the "L" key (upper and lower case work the same these days) and then press
- RETURN. This will fill the disassembly subdisplay with 19 lines of
- disassembled code (which 19 lines were disassembled really doesn't matter).
- Study it until you can tell at a glance which parts are the address, which
- parts are the hex bytes, and which parts are the disassembled code.
-
- Type "L" and press RETURN again - you get the next 19 lines of memory (see,
- we told you it was a lot like the built-in monitor).
-
- Now, let's do something a tad more useful. Press the "S" key and RETURN
- (you just told GSBug to start single-stepping through your application). Be
- careful what keys you press while in the single step mode - lots of
- weird-looking things can happen (they're all normal, but if you don't expect
- them you can get confused). For now, ONLY press the keys this tutorial tells
- you to. If you can't wait and just HAVE to bang on all of the various keys,
- then go ahead - reboot once you've totally confused yourself, pop back into
- GSBug and catch up with the rest of the folks reading this.
-
- To tell GSBug to execute the highlighted instruction, press the SPACE BAR one
- time. Heck, press it several times so that you get a bunch of lines of
- disassembled code on the screen. Notice that the code scrolls up and the
- "highlighted" area stays in the same place? Notice it's kind of close to the
- bottom of the screen? Later we'll tell you how to move it up higher.
-
- Press the ESC key. That takes you out of single-step and returns you to the
- command line. Press "S" and RETURN again to restart single stepping. Notice
- that the lines ABOVE the highlighted area have been erased? Remember that -
- if you halt single-stepping and need some piece of info above the highlighted
- area, then write it down because it'll be wiped out when you restart
- single-stepping (or when you do any of a bunch of different things). If you
- have your printer connected to slot 1, then you can print GSBug's screen using
- the "P" command (press "P" and RETURN - be sure you're NOT single-stepping
- when you do this, "P" only prints from the command line).
-
-
- Lock a Tractor Beam onto Them...
-
- Want an easy way to have the computer step through source for you without
- having to bang again and again on the SPACE BAR? Start single-stepping
- ("S" and RETURN), then press RETURN again. VRRRROOOOMMMMMM! Can't read all
- the stuff flying by? No sweat, press SPACE BAR and you'll be back to
- single-stepping. Pressing the RETURN key a second time kicked GSBug into
- "Trace" mode.
-
- Trace actually has two speeds, the default is fast (we like to test
- developers' speed reading skills). To kick TRACE into low gear, press the
- left arrow key. If you're in single-step mode, then you won't see the speed
- change (after all, it affects TRACE, not SINGLE-STEP), but fear not brave
- developer, the speed change has been made. Press RETURN again (to be sure
- you're in TRACE mode) and press the left arrow key (if you didn't a few lines
- ago) to kick TRACE into low gear. Want to get back into high gear? Press the
- right arrow key (sneaky, eh?).
-
-
- RED ALERT!
-
- Do _NOT_ press the down arrow key while TRACING or single-stepping (unless
- you know what you're doing). The down arrow key tells GSBug to SKIP the
- highlighted instruction! This is a great way to step over BRK instructions,
- but it's not a real smart thing to do at random while TRACING through an
- application (randomly skipping an instruction generally results in a crash).
-
-
- Move That Line Up
-
- If you want to raise the highlighted line within the disassembly subdisplay,
- then press ESC (to get back to the command line) and type "SET" (don't type
- the quotes, OK?) and press RETURN. The up and down arrows now control the
- vertical position of the highlighted bar within the disassembly subdisplay.
- Position the bar where you want it and press ESC. That position will be
- remembered until the next time you move it or until you reboot (then it goes
- back to the default position). The manual for GSBug tells you how to save
- this new position to a configuration file (it also tells you that pressing the
- left and right arrow will move the stack subdisplay up and down, and that
- pressing a number less than eight will change the slot used to print the
- screen).
-
-
- Reaching the Breaking Point
-
- Alright, time for some fancy stuff! The next couple of sections will assume
- you were running the IIGS Finder when you popped into GSBug (other apps will
- work just fine, but why be difficult?). GSBug will let you break on any tool
- call (or calls) that you specify, so let's set a few tool breaks and learn how
- to use this feature.
-
- From GSBug's command line (press ESC if you're still stepping or tracing),
- type "settbrk _sysbeep" and press RETURN. If GSBug beeps at you instead of
- accepting this line, then you didn't type it right (there are two t's in
- "settbrk" and don't type the quotes). Type "settbrk #090E" and press RETURN.
- You just added two tool calls to GSBug's list of tools to break on. The first
- one was added by naming the tool to break on ("_sysbeep") and the second one
- was added by specifying the tool's number ("#090E"). This lets you set tool
- breaks regardless of whether you know the tool's name or number.
-
- Type "showbrks" (or "sh") and press RETURN to see the complete list of tool
- breaks that GSBug has been told about. Notice that the left hand side of
- the screen now implies that you can set breaks on GS/OS calls? That's
- because you can!
-
- Now, when either a call to SysBeep or a call to NewWindow (tool $090E is
- NewWindow) is made, we'll be dropped back into GSBug.
-
-
- Oh Yeah? Prove It!
-
- Make sure you're at GSBug's command line (press ESC if you aren't). Type "R"
- and RETURN. This resumes full execution of your application. To test the
- tool breaks we just set, we need to force the Finder (or whatever app you
- stubborn folks decided to use instead of the Finder) to make a call to
- NewWindow and/or to SysBeep. Double click on a disk icon, get info on a file,
- open a folder, open a desk accessory, etc to get the Finder to open a new
- window. Notice that you land in GSBug?
-
- Press "S" and RETURN to enter single-stepping. Notice that the highlighted
- instruction is "NewWindow". Ah, the tool break works. Now, press SPACE BAR
- to execute the NewWindow call, press ESC to stop single-stepping, and type "R"
- and RETURN to resume running the Finder. (if we didn't bother to single step
- across the NewWindow call, we would just fall right back into the debugger
- since we have a break point set on that call).
-
-
- Take it Out, Wise Guy!
-
- Tired of falling into GSBug every time a new window is opened? There are
- several ways to remove tool breaks. The easiest way is to type "tbrkout"
- or "t-" to stop breaking on the listed tool calls without trashing the list.
- Typing "tbrkin" (or "t+") makes GSBug start breaking on them again.
-
- To clear the list of tool breaks, either type "clrtbrk _sysbeep" (to remove
- the sysbeep break we put in earlier) and repeat that for "_newwindow" or wipe
- the all out with "clralltbrks". "ctb" is shorthand for ClrTBrk, and if you
- don't specify which tool call to stop breaking on, it clears them all.
-
-
- Cheap Trick #1
-
- Being able to break into the debugger based on a tool call is VERY handy! But
- what if you want to see the stack being set up BEFORE your code gets all the
- way down to the tool call itself? After all, if you're not putting enough
- parameters on the stack (or too many), then breaking on the tool call itself
- is too late to watch the stack being built. There's an easy solution for
- this - stick a SysBeep call in your source ABOVE the tool call you really
- want to break on and set a tool break on SysBeep. This will let you
- single-step through the stack setup for the call you're really interested in.
- OK, so it's a cheap trick, but it's darned effective.
-
- This trick was invented in the dark ages before DebugStr was part of GSBug
- (DebugStr is explained near the very end of this document and is a little
- trickier to use than Cheap Trick #1).
-
-
- I Don't Like My Registers
-
- Remember earlier when we mentioned that you can change the values of the
- various registers from within GSBug? This lets you change values that are
- about to be pushed on the stack and do all kinds of neat things. You're
- sharp, so we won't bore you with all the things this lets you do, we'll
- just cut right to the description of HOW to do it.
-
- To change the accumulator's value, type "a=value" on the command line.
- Replace "value" with the hex value you want to stuff into the accumulator.
- Type "x=value" to set the x register, "y=value" to set the y register, etc.
- You can't type "a=x" to set the accumulator to the value in the x register,
- but since you can see the x register's value, this isn't that big of a loss.
-
-
- Cheap Trick #2
-
- If you accidently SKIP an instruction that you didn't mean to (and you haven't
- executed any more since then), you can "unskip" it by exiting single-step
- mode, then type "pc=value" where "value" is the address (all three bytes just
- to be safe) that the skipped instruction is at. Press RETURN and then resume
- single-stepping (notice that you're back at the skipped instruction now).
-
- This tricks works because the "pc" register is the program counter (the thing
- that determines what address will have its instruction executed next).
-
-
- Cheap Trick #3
-
- Fudging the program counter (pc=value) will let you push extra info on the
- stack in cases where you didn't push enough for a call. Be careful with
- this - you may need to set the accumulator before re-executing an
- already-executed PHA and you could totally trash the stack if you're not
- paying attention. One place this is handy is to compensate for passing a
- WORD instead of a LONG (easy to do with C when you're dealing with resource
- ID's). If you don't understand this trick, don't use it!
-
- A minor modification on this stunt is (obviously) to pull extra bytes OFF of
- the stack in cases where you left something on there that shouldn't have been
- left on. Once you spot problems like too much or too little data on the
- stack, FIX YOUR SOURCE CODE AND RECOMPILE IT!!!! You don't really want to
- have to find this bug a second time do you?
-
-
- Cheap Trick #4
-
- GSBug is a lot like the monitor in certain respects. That means many of the
- commands you're used to from the monitor will work under GSBug. Setting
- values in memory under GSBug is done just like it is under the monitor
- (just address : value1 value2 value3 value4 ...). addressT and RETURN
- starts tracing at the memory location specified by "address". addressS and
- RETURN starts single-stepping at the memory location specified by "address".
- addressL and RETURN lists 19 lines of disassemby starting at the memory
- location specific by "address". You can even use the built-in mini assembler
- if you want (type "asm" and RETURN).
-
-
- Peering Into Memory
-
- The 19 "windows on memory" can be used by typing "mem" and RETURN on the
- command line. This puts the cursor on the far right of the first line in the
- RAM subdisplay area. Type the address you want to watch and press RETURN.
- That will move you to the next line (so you can set the address for the second
- memory location). If you want to see two bytes starting at that address,
- press "P". To see three bytes, press "L". "Z" toggles between direct-page
- and absolute addressing, ":" toggles between direct, 2-byte indirect, and
- 3-byte indirect addressing. Press "?" for more info.
-
- This provides a nice way to look at variables in memory, dereference
- pointers/handles, etc. When the contents of any "peered into" location
- changes, the corresponding line on GSBug's screen will change also.
-
-
- Cheap Trick #5
-
- (this one's actually not cheap, it's pretty danged useful!) While
- single-stepping or tracing, you can see other "screens" by pressing various
- keys (this accounts for the weird effects we alluded to earlier). Press "S" to
- see the SHR screen (your desktop application's desktop), "D" to see the double
- hi-res screen, "T" to see the text screen, "8" to see 80-column display, "4" to
- see 40-column display, "H" to see the Hi-Res screen, "L" for the Lo-Res screen,
- and ESC to exit single-stepping. This lets you see your application's screen
- instead of GSBug's screen (makes it a LOT easier to debug your apps when you can
- see their screens).
-
-
- Don't Touch That Dial!
-
- The material covered so far gives you a decent foundation to draw upon as you
- hunt bugs in your own software. We've only lightly touched on what GSBug can
- really do (we're not typing all 140 or so pages of the manual into this
- "introduction" to GSBug). GSBug offers a lot of power and capabilities that
- should be learned by all developers.
-
- Before we wrap up this tutorial we want to cover the use of templates and
- describe some of the new features in GSBug v1.6 that aren't described in
- the printed manual.
-
-
- Templates By Jim
-
- GSBug provides an easy way for you to view portions of memory through
- templates. This allows you to "see" the data structures in memory just
- like they appear in the documentation (divided into various fields). The
- GSBug.Templates file that you were supposed to have placed in the
- SYSTEM/SYSTEM.SETUP folder of your boot disk contains a complete set of
- templates for use with our interface files. One of the Apple II Developer
- Technical Support Engineers put these templates together (and came up with
- a pretty neat way to build in a "help system" - so tell Jim "thanks" next
- time a template bails you out of a jam).
-
- GSBug does NOT automatically load those templates unless you rename the
- file to "GSBug.AutoTemp" (see the "GSBug.Specs" file for more information).
- You have to tell GSBug to load them (and you can unload them later). To load
- the templates, just type "LoadTemp"--if you don't put a pathname after LoadTemp,
- GSBug assumes you mean "*/System/System.Setup/GSBug.Templates".
-
- To view a piece of memory with a template, simply determine the starting
- address of the template. The starting address can be found in a number of
- ways - you can dereference a pointer that you just pushed on the stack, etc.
- Then, type an underscore, the type of structure you want used, a blank space,
- and the starting address (don't forget the bank). (For example, if you know
- you have a grafport starting at location 06/15E4, type: "_grafport 06/15E4"
- and press RETURN.
-
- To use the built-in template help system that Jim came up with (thanks Jim!),
- just type: "_template" and press return. This will give you a list of all
- the categories of help you can get more info on (such as ADB, FONTS, etc).
- The categories are grouped by toolbox manager. To get details on a particular
- toolbox manager's tool calls, type "_toolmgrname" and press RETURN (replace
- "_toolmgrname" with the name of any tool manager - lead with an underscore or
- it won't work). (for example, "_quickdraw" for details on QuickDraw II data
- structures) For more details, read the separate documentation file on using
- the templates.
-
- If you want to create your own custom templates, then read the GSBug manual
- (pages 86-88) or decipher the templates in the GSBug.Templates file. To
- unload the templates (and free up the memory they're eating), type "killtemp"
- and press RETURN from GSBug's command line.
-
-
- Debugger Tool Calls
-
- There are several fake tool calls that the debugger intercepts and acts on.
-
- They are SetMileStone, DebugStr, DebugVersion, DebugStatus, DebugSetHook,
- and DebugGetInfo. The two most important ones are SetMileStone and DebugStr.
-
- SetMileStone simply changes the debugger's copyright message to be a string of
- your choice and lets your app keep running. If you're having a problem
- figuring out where your code was last at before it jumped off into the weeds,
- then sprinkle SetMileStone calls into your source code (with different strings
- on each, of course). Then, when your app chokes and dies, you'll be presented
- with the text from the last SetMileStone that was executed.
-
- DebugStr works like SetMileStone (it changes the copyright string to something
- with info about your application) except it dumps you immediately into GSBug.
- This is a little more work than Cheap Trick #1, but you can line up your source
- easier (since you'll have the debug string's message to guide you).
-
- DebugVersion and DebugStatus act just like normal version and status calls for
- regular tool sets - they simply allow you to verify whether GSBug is running
- and if so, what version of the debugger is running before you try to make any
- debugger tool calls.
-
- The tool numbers and parameter lists for these calls are:
-
- Name Tool # Parameter (returns)
- -------------- ------ ---------------------------------------------------
- DebugStatus $06FF (non-zero = true, ToolLocator error it not loaded)
- DebugStr $09FF pointer to Pascal-style string
- DebugVersion $04FF ($159F for v1.5B9, $16FF for v1.6)
- SetMileStone $0AFF pointer to Pascal-style string
- DebugSetHook $0BFF pointer to routine called by "n" cmd (see GSBug.Specs)
- DebugGetInfo $0CFF see GSBug.Specs
-
-
- Cheap (and short) Trick #6
-
- If you get really fancy, you can build the strings for DebugStr and
- SetMileStone on the fly and imbed the values of key variables into them to
- further simplify locating bugs.
-
-
- Calling all Debuggers
-
- Do _NOT_ leave calls to these debugger tools in your software when you ship it
- to customers! Why? Because making these calls on a system that doesn't have
- GSBug installed makes a real mess.
-
-
- Want More Info?
-
- Contact Resource Central and order the full package.
-
- Resource Central, Inc.
- P.O. Box 11250
- Overland Park, KS 66207
-
- (913) 469-6502
- Fax: (913) 469-6507
- AppleLink: A2.CENTRAL
- Internet: A2.CENTRAL@AppleLink.Apple.com
- GEnie: RC.ELLEN
-
- [end of GSBug.Tutorial]
-